package initialize

import (
	"fmt"
	"github.com/go-redis/redis"
	"goods_srv/global"
)

func InitRedis() {
	global.RedisClient = redis.NewClient(&redis.Options{
		Addr:     "localhost:6379",
		Password: "", // no password set
		DB:       0,  // use default DB
	})

	pong, err := global.RedisClient.Ping().Result()
	if err != nil {
		panic(err)
		return
	}
	fmt.Println("redis连接成功", pong)
	// Output: PONG <nil>
}
